﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="QuXianBGS.aspx.cs" Inherits="Web.Pages.QuShui.DiXiaS.JiChuXX.QuXianBGS" Theme="Default" %>

<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="../../../../JS/AddEditCancel.js"></script>
    <script src="../../../../JS/jquery.js"></script>
    <script type="text/javascript">
      
        function display(op, id) {
            hdCollection.Set("ID", id);
            if (op == "add") {
                btnAdd.SetVisible(false);
                lblOperateTip.SetText("添加");
                txtXZQBH.SetEnabled(true);
                txtXZQBH.SetText("");
                cmbXZQMC.SetText("");
                txtGongSiBH.SetText("");
                txtGongSiMC.SetText("");
                txtDIZHI.SetText("");
                txtYOUBIAN.SetText("");
                txtZHUBR.SetText("");
                txtZhiBiaodh.SetText("");
                txtFuZeR.SetText("");
                txtFuZeRDH.SetText("");
                listCover(true, "divList");
                $("#GridViewContentTable").show();
                txtXZQBH.Focus();
            }
            else if (op == "edit") {
                //debugger;
                btnAdd.SetVisible(false);
                lblOperateTip.SetText("修改");
                txtXZQBH.SetEnabled(false);
                listCover(true, "divList");
                $("#GridViewContentTable").show();
                ASPxCallback1.PerformCallback("info");
                cmbXZQMC.Focus();
            }
            else {
                $("#GridViewContentTable").hide();
                btnAdd.SetVisible(true);
                listCover(false, "divList");
            }
        }

        function del(id) {
            hdCollection.Set("ID", id);
            if (confirm("确认删除吗？")) {
                ASPxCallback1.PerformCallback("del");
            }
            else {
                hdCollection.Set("ID", -1);
            }
        }

        function save() {
            if (txtXZQBH.GetText() == "") {
                alert("行政区编号不能为空！");
                txtXZQBH.Focus();
                return;
            }
            if (cmbXZQMC.GetText() == "") {
                alert("请选择行政区名称！");
                cmbXZQMC.Focus();
                return;
            }
            if (txtGongSiBH.GetText() == "") {
                alert("公司编号不能为空！");
                txtGongSiBH.Focus();
                return;
            }
            if (txtGongSiMC.GetText() == "") {
                alert("公司名称不能为空！");
                txtGongSiMC.Focus();
                return;
            }
            //if (txtZHUBR.GetText() == "") {
            //    alert("制表人不能为空！");
            //    txtZHUBR.Focus();
            //    return;
            //}
            //if (txtFuZeR.GetText() == "") {
            //    alert("负责人不能为空！");
            //    txtFuZeR.Focus();
            //    return;
            //}
            ASPxCallback1.PerformCallback("saveValidate");
        }

        function ASPxCallback1Complete(rs) {
            var arr = rs.split('|');
            var type = arr[0];
            var state = arr[1];
            if (state != "0") {
                alert(arr[2]);
                txtGongSiBH.Focus();
            }
            else {
                if (type == "info") {
                    txtXZQBH.SetText(arr[3]);
                    cmbXZQMC.SetText(arr[4]);
                    txtGongSiBH.SetText(arr[5]);
                    txtGongSiMC.SetText(arr[6]);
                    txtDIZHI.SetText(arr[7]);
                    txtYOUBIAN.SetText(arr[8]);
                    txtZHUBR.SetText(arr[9]);
                    txtZhiBiaodh.SetText(arr[10]);
                    txtFuZeR.SetText(arr[11]);
                    txtFuZeRDH.SetText(arr[12]);
                }
                else if (type == "del") {
                    alert(arr[2]);
                    gvList.PerformCallback();
                }
                else if (type == "saveValidate") {

                    ASPxCallback1.PerformCallback("save");
                }
                else if (type == "save") {
                    alert(arr[2]);
                    display("init", -1);
                    gvList.PerformCallback();
                }
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div class="tabletitle1" align="center">
            区县办公室
        </div>
        <div style="display: none;">
            <dx:ASPxHiddenField ID="hdCollection" ClientInstanceName="hdCollection" runat="server"></dx:ASPxHiddenField>
            <dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallback1Complete(e.result);}"></dx:ASPxCallback>
        </div>
        <asp:UpdatePanel runat="server" ID="updatePanel">
            <ContentTemplate>
                <dx:ASPxPageControl ID="ASPxPageControl1" runat="server" ActiveTabIndex="0" Width="100%">
                    <TabPages>
                        <dx:TabPage Text="区县办公室列表">
                            <ContentCollection>
                                <dx:ContentControl runat="server" SupportsDisabledAttribute="True">
                                    <div id="divList">
                                        <div align="center">
                                        </div>
                                        <div align="center">
                                            <dx:ASPxGridView ID="gvList" ClientInstanceName="gvList" runat="server" EnableCallBacks="false" AutoGenerateColumns="False" KeyFieldName="ID" Theme="Aqua1" Width="100%" OnCustomCallback="gvList_CustomCallback">
                                                <Columns>
                                                    <dx:GridViewDataTextColumn FieldName="S_QUXIANBH" Caption="编号" Width="5%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_XINGZHENGQBH" Caption="行政区编号" Width="9%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_XINGZHENGQMC" Caption="行政区名称" Width="9%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_GONGSIBH" Caption="公司编号" Width="9%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_GONGSIMC" Caption="公司名称" Width="12%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_GONGSIDZ" Caption="公司地址" Width="13%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_YOUBIAN" Caption="邮编" Width="7%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_ZHIBIAOR" Caption="制表人" Width="7%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_ZHIBIAORDH" Caption="制表人电话" Width="7%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_FUZER" Caption="负责人" Width="7%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_FUZERDH" Caption="负责人电话" Width="7%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn Width="4%">
                                                        <DataItemTemplate>
                                                            <a href="#" onclick="display('edit','<%#Eval("ID")%>')">修改</a>
                                                        </DataItemTemplate>
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn Width="4%">
                                                        <DataItemTemplate>
                                                            <a href="#" onclick="del('<%#Eval("ID")%>')">删除</a>
                                                        </DataItemTemplate>
                                                    </dx:GridViewDataTextColumn>
                                                </Columns>
                                                <SettingsBehavior AllowFocusedRow="True"  ColumnResizeMode="Control" />
                                                <Settings VerticalScrollableHeight="210" VerticalScrollBarMode="Auto" />
                                                <ClientSideEvents Init="function(s,e){AdjustSize(350,gvList);}" />
                                            </dx:ASPxGridView>
                                            <dx:ASPxLoadingPanel ID="ASPxLoadingPanel1" ClientInstanceName="loadpanel1" runat="server" ContainerElementID="gvList" Modal="true" Theme="Metropolis" Text=""></dx:ASPxLoadingPanel>
                                        </div>
                                    </div>
                                    <div style="height: 3px;"></div>
                                    <div style="text-align: right">
                                        <hr />
                                        <dx:ASPxButton ID="btnAdd" ClientInstanceName="btnAdd" runat="server" Text="添加" AutoPostBack="false" ClientSideEvents-Click="function(s,e){display('add',-1)}" UseSubmitBehavior="false">
                                        </dx:ASPxButton>
                                    </div>
                                    <div id="GridViewContentTable" style="display: none;">
                                        <div class="tabletitle1" align="center">
                                            <dx:ASPxLabel ID="lblOperateTip" runat="server" ClientInstanceName="lblOperateTip" Text="添加"></dx:ASPxLabel>
                                        </div>
                                        <table style="width: 65%; margin: auto;" class="TableLayoutFont">
                                            <tr>
                                                <td align="right" style="width: 20%;">行政区编号：</td>
                                                
                                                <td style="width: 30%;">
                                                    <dx:ASPxTextBox ID="txtXZQBH" ClientInstanceName="txtXZQBH" runat="server" Width="100%" ClientEnabled="true" MaxLength="15">
                                                        <ClientSideEvents KeyPress="function(s,e){OnKeyNext(cmbXZQMC);}"/>
                                                    </dx:ASPxTextBox>
                                                </td>
                                                <td align="right" style="width: 20%;">行政区名称：
                                                </td>
                                                <td style="width: 30%;">
                                                    <asp:Panel runat="server" ID="Panel2">
                                                        <dx:ASPxComboBox runat="server" ID="cmbXZQMC" Width="80%" ClientInstanceName="cmbXZQMC">
                                                           <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtGongSiBH);}" />
                                                        </dx:ASPxComboBox>
                                                    </asp:Panel>
                                                    <%--<dx:ASPxTextBox ID="cmbXZQMC" ClientInstanceName="cmbXZQMC" runat="server" Width="100%" MaxLength="15">
                                                        <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtGongSiBH);}" />
                                                    </dx:ASPxTextBox>--%>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right">公司编号：
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtGongSiBH" ClientInstanceName="txtGongSiBH" runat="server" Width="100%" MaxLength="30">
                                                        <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtGongSiMC);}" />
                                                    </dx:ASPxTextBox>
                                                </td>
                                                <td align="right">公司名称：
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtGongSiMC" ClientInstanceName="txtGongSiMC" runat="server" Width="100%" MaxLength="30">
                                                        <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtDIZHI);}" />
                                                    </dx:ASPxTextBox>
                                                </td>
                                            </tr> 
                                            <tr>
                                                <td align="right">公司地址：
                                                </td>
                                                <td colspan="3">
                                                    <dx:ASPxTextBox ID="txtDIZHI" ClientInstanceName="txtDIZHI" runat="server" Width="100%" MaxLength="50">
                                                        <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtYOUBIAN);}" />
                                                    </dx:ASPxTextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right">邮编：
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtYOUBIAN" ClientInstanceName="txtYOUBIAN" runat="server" Width="100%" MaxLength="15">
                                                        <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtZHUBR);}" />
                                                    </dx:ASPxTextBox>
                                                </td>
                                               
                                            </tr>
                                            <tr>
                                                <td align="right">制表人：
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtZHUBR" ClientInstanceName="txtZHUBR" runat="server" Width="100%" MaxLength="15">
                                                        <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtZhiBiaodh);}" />
                                                    </dx:ASPxTextBox>
                                                </td>
                                                 <td align="right">制表电话：
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtZhiBiaodh" ClientInstanceName="txtZhiBiaodh" runat="server" Width="100%" MaxLength="15">
                                                        <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtFuZeR);}" />
                                                    </dx:ASPxTextBox>
                                                </td> 
                                            </tr>
                                            <tr>
                                                <td align="right">负责人：
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtFuZeR" ClientInstanceName="txtFuZeR" runat="server" Width="100%" MaxLength="15">
                                                        <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtFuZeRDH);}" />
                                                    </dx:ASPxTextBox>
                                                </td>
                                                 <td align="right">负责电话：
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtFuZeRDH" ClientInstanceName="txtFuZeRDH" runat="server" Width="100%" MaxLength="15">
                                                        <ClientSideEvents KeyPress="function(s,e){OnKeyNext(btnSave);}" />
                                                    </dx:ASPxTextBox>
                                                </td> 
                                            </tr>
                                        </table>
                                        <table id="GridViewButtonTable" runat="server" width="100%">
                                            <tr>
                                                <td style="text-align: right;">
                                                    <hr />
                                                    <dx:ASPxButton ID="btnSave" ClientInstanceName="btnSave" runat="server" Text="保存" AutoPostBack="false" UseSubmitBehavior="false" ClientSideEvents-Click="function(s,e){save();}">
                                                    </dx:ASPxButton>
                                                    <dx:ASPxButton ID="btnCancel" runat="server" Text="放弃" AutoPostBack="false" ClientSideEvents-Click="function(s,e){display('init',-1);}" UseSubmitBehavior="false">
                                                    </dx:ASPxButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </dx:ContentControl>
                            </ContentCollection>
                        </dx:TabPage>
                        <dx:TabPage Text="涉水对象接口">
                            <ContentCollection>
                                <dx:ContentControl runat="server" SupportsDisabledAttribute="True">
                                     <fieldset style="padding: 2%; width: 80%; height: 120px; margin: auto;">
                                        <legend>地下水</legend>
                                        <fieldset style="width: 42%; height: 80px; float: left;">
                                            <legend style="font-size: 13px;">上传数据</legend>
                                            <table style="margin: auto;">
                                                <tr>
                                                    <td>年份&nbsp;
                                                    </td>
                                                    <td>
                                                        <dx:ASPxComboBox ID="cbmDiXiaS" runat="server" ValueType="System.String">
                                                            <Items>
                                                                <dx:ListEditItem Text="2011" Value="0" />
                                                                <dx:ListEditItem Text="2012"  Value="1"/>
                                                                <dx:ListEditItem Text="2013" Value="2"/>
                                                                <dx:ListEditItem Text="2014" Value="3"/>
                                                                <dx:ListEditItem Text="2015" Value="4"/>
                                                                <dx:ListEditItem Text="2016"  Value="5" Selected="true" />
                                                            </Items>
                                                        </dx:ASPxComboBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="right" colspan="2">
                                                        <dx:ASPxButton ID="btnShangCSJ" runat="server" Text="上传数据" Width="80px" UseSubmitBehavior="false"></dx:ASPxButton>
                                                    </td>
                                                </tr>
                                            </table>
                                        </fieldset>
                                        <div style="width: 4%; float: left;">&nbsp;</div>
                                    </fieldset> 

                                    <fieldset style="padding: 2%; width: 80%; height: 120px; margin: auto;">
                                        <legend>计划用水</legend>
                                        <fieldset style="width: 42%; height: 80px; float: left;">
                                            <legend style="font-size: 13px;">上传数据</legend>
                                            <table style="margin: auto;">
                                                <tr>
                                                    <td>年份&nbsp;
                                                    </td>
                                                    <td>
                                                        <dx:ASPxComboBox ID="ASPxComboBox1" runat="server" ValueType="System.String">
                                                            <Items>
                                                                <dx:ListEditItem Text="2011" Value="0" />
                                                                <dx:ListEditItem Text="2012"  Value="1"/>
                                                                <dx:ListEditItem Text="2013" Value="2"/>
                                                                <dx:ListEditItem Text="2014" Value="3"/>
                                                                <dx:ListEditItem Text="2015" Value="4"/>
                                                                <dx:ListEditItem Text="2016"  Value="5" Selected="true" />
                                                            </Items>
                                                        </dx:ASPxComboBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="right" colspan="2">
                                                        <dx:ASPxButton ID="ASPxButton1" runat="server" Text="上传数据" Width="80px" UseSubmitBehavior="false"></dx:ASPxButton>
                                                    </td>
                                                </tr>
                                            </table>
                                        </fieldset>
                                        <div style="width: 4%; float: left;">&nbsp;</div>
                                        <fieldset style="width: 42%; height: 80px; float: left;">
                                            <legend style="font-size: 13px;">下载数据</legend>
                                            <table style="margin: auto;" class="tabLay">
                                                <tr>
                                                    <td>&nbsp;
                                                    </td>
                                                    <td></td>
                                                </tr>
                                                <tr>
                                                    <td align="" colspan="2">
                                                        <dx:ASPxButton ID="ASPxButton2" runat="server" Text="下载数据" Width="80px" UseSubmitBehavior="false"></dx:ASPxButton>
                                                    </td>
                                                </tr>
                                            </table>
                                        </fieldset>
                                    </fieldset>
                                </dx:ContentControl>
                            </ContentCollection>
                        </dx:TabPage>
                    </TabPages>
                </dx:ASPxPageControl>

            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>
